#include "RotatorY.h"

static const float pi = 3.1415926535f;

RotatorY::RotatorY(QWidget *parent, MatrixStack &mtxStack)
: SingleSliderWidget(parent, mtxStack)
{
	setCaption(tr("Y rotation: 0\u00B0"));

	setSliderRange(-180, 180);
}

void RotatorY::valueChanged(int newValue)
{
	Matrix &mtx = matrix();

	mtx.identity();
	cml::matrix_rotate_about_world_y(mtx, newValue * pi / 180);

	QString str(tr("Y rotation: "));
	str.append(QString().sprintf("%d", newValue)).append(tr("\u00B0"));

	setCaption(str);
}

